﻿<%@ Page Title="" Language="C#" MasterPageFile="~/masterPage/admin/Manage.master"
    AutoEventWireup="true" CodeFile="NewsCategory.aspx.cs" Inherits="NewsCategory" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <div id="camanager" class="m_cate2">
        <h3>
            &copy;类别管理</h3>
        <div class="con">
            <div>
                提示：点击类别名称直接修改，按回车,点击其它地方确认修改</div>
            <br />
            <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All"
                EnableRoundedCorners="false" />
            <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
                <asp:ListView ID="repCatagory" runat="server" DataKeyNames="CaID" DataSourceID="SqlDataSource1">
                    <ItemTemplate>
                        <tr style="background: #fff; font: 12px/16px segoe ui; line-height: 25px;">
                            <td>
                                <asp:Label ID="CaNameLabel" runat="server" Text='<%# Eval("CaName") %>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="CreateDateLabel" runat="server" Text='<%# Eval("CreateDate") %>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="CreateUserLabel" runat="server" Text='<%# Eval("UserName") %>'></asp:Label>
                            </td>
                            <td>
                                <asp:LinkButton ID="btnEdit" runat="server" Text="更新" CommandName="Edit"></asp:LinkButton>
                            </td>
                            <td>
                                <asp:LinkButton ID="lbtlDelca" CommandArgument='<%#Eval("CaID")%>' runat="server"
                                    OnClick="LbtnDel_Click" OnClientClick="return confirm('将删除该类别以及其下所有新闻和评论，是否继续？');">删除</asp:LinkButton>
                            </td>
                        </tr>
                    </ItemTemplate>
                    <AlternatingItemTemplate>
                        <tr style="background: #EDEDED; font: 12px/16px segoe ui; line-height: 25px;">
                            <td>
                                <asp:Label ID="CaNameLabel" runat="server" Text='<%# Eval("CaName") %>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="CreateDateLabel" runat="server" Text='<%# Eval("CreateDate") %>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="CreateUserLabel" runat="server" Text='<%# Eval("UserName") %>'></asp:Label>
                            </td>
                            <td>
                                <asp:LinkButton ID="btnEdit" runat="server" Text="更新" CommandName="Edit"></asp:LinkButton>
                            </td>
                            <td>
                                <asp:LinkButton ID="lbtlDelca" CommandArgument='<%#Eval("CaID")%>' runat="server"
                                    OnClick="LbtnDel_Click" OnClientClick="return confirm('将删除该类别以及其下所有新闻和评论，是否继续？');">删除</asp:LinkButton>
                            </td>
                        </tr>
                    </AlternatingItemTemplate>
                    <EditItemTemplate>
                        <tr>
                            <td>
                                <asp:TextBox ID="tbCaName" runat="server" Text='<%# Bind("CaName") %>'></asp:TextBox>
                            </td>
                            <td>
                                <asp:Button ID="btnUpdate" runat="server" Text="更新" CommandArgument='<%#Eval("CaID")%>'
                                    CommandName="Update"></asp:Button>
                                <asp:Button ID="BtnCancel" runat="server" Text="取消" CommandName="Cancel" CausesValidation="false">
                                </asp:Button>
                            </td>
                        </tr>
                    </EditItemTemplate>
                    <EmptyDataTemplate>
                        <table id="Table1" runat="server" style="">
                            <tr>
                                <td>
                                    没有类别数据.
                                </td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>
                    <LayoutTemplate>
                        <table id="Table2" runat="server" cellpadding="0" cellspacing="0" style="border: 1px solid #C3C3C3;
                            width: 100%;">
                            <tr id="Tr1" runat="server">
                                <td id="Td1" runat="server">
                                    <table id="itemPlaceholderContainer" runat="server" border="0" style="font: 12px/16px segoe ui;
                                        width: 100%;" cellspacing="0">
                                        <tr id="Tr2" runat="server" style="background: #EDEDED; line-height: 25px;">
                                            <th id="Th1" runat="server" style="text-align: left; font-weight: normal;">
                                                类别名称
                                            </th>
                                            <th id="Th2" runat="server" style="text-align: left; font-weight: normal;">
                                                创建时间
                                            </th>
                                            <th id="Th3" runat="server" style="text-align: left; font-weight: normal;">
                                                创建者
                                            </th>
                                            <th id="Th4" runat="server" style="text-align: left; font-weight: normal;">
                                                更新
                                            </th>
                                            <th id="Th5" runat="server" style="text-align: left; font-weight: normal;">
                                                删除
                                            </th>
                                        </tr>
                                        <tr id="itemPlaceholder" runat="server">
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tfoot>
                                <tr>
                                    <td colspan="5">
                                        <telerik:RadDataPager ID="RadDataPagerProducts" runat="server" PagedControlID="repCatagory"  EnableEmbeddedSkins="false"
                                            PageSize="5" Skin="Metro" >
                                            <Fields>
                                                <telerik:RadDataPagerButtonField FieldType="FirstPrev"></telerik:RadDataPagerButtonField>
                                                <telerik:RadDataPagerButtonField FieldType="Numeric"></telerik:RadDataPagerButtonField>
                                                <telerik:RadDataPagerButtonField FieldType="NextLast"></telerik:RadDataPagerButtonField>
                                            </Fields>
                                        </telerik:RadDataPager>
                                    </td>
                                </tr>
                            </tfoot>
                        </table>
                    </LayoutTemplate>
                </asp:ListView>
            </telerik:RadAjaxPanel>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Metro" EnableEmbeddedSkins="false">
            </telerik:RadAjaxLoadingPanel>
        </div>
        <div class="footer">
            <p>
                &nbsp;</p>
        </div>
    </div>
    <div style="clear: both;">
    </div>
    <div id="camanager2" class="m_cate2">
        <h3>
            &copy;添加类别</h3>
        <div class="con">
            请输入类别名称：<asp:TextBox ID="txtCaName" runat="server" ValidationGroup="addCa"></asp:TextBox><asp:RequiredFieldValidator
                ID="RequiredFieldValidator1" runat="server" ErrorMessage="请输入类别" ControlToValidate="txtCaName"
                ValidationGroup="addCa"></asp:RequiredFieldValidator>
            <asp:Button ID="btnAdd" runat="server" Text="确定" OnClick="btnAdd_Click" ValidationGroup="addCa" />
        </div>
        <div class="footer">
            <p>
                &nbsp;</p>
        </div>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:XunPanConnectionString %>"
        SelectCommand="SELECT  N.CaID, N.CaName, N.CreateDate, U.UserName FROM [XPNewsCateGory] N,  aspnet_Users U WHERE  N.CreateUserID = U.UserId ORDER BY  N.CaID"
        UpdateCommand="UPDATE [XPNewsCateGory] SET [CaName] = @CaName, [CreateTime] = GETDATE() WHERE [CaID] = @CaID" >
        <UpdateParameters>
            <asp:Parameter Name="CaName" DbType="String"></asp:Parameter>
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>
